<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('终端划拨')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-posTransferRecord-transfer">

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">划拨信息：</label>
                <div class="col-sm-8">
                    <input id="currentAgent" type="hidden" name="currentAgent" value="" >
                    <input id="currentMerno" type="hidden" name="currentMerno" value="" >
                    <input name="posNo" onclick="selectPosNo()" readonly id="posNo"  type="text" placeholder="划拨信息" class="form-control" required>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">目标服务商编号：</label>
                <div class="col-sm-8">
                    <input name="targetAgent" id="targetAgent" class="form-control" type="text" readonly required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">目标服务商名称：</label>
                <div class="col-sm-8">
                    <input name="targetAgentName" onclick="selectTargetAgent()" readonly id="targetAgentName"  type="text" placeholder="目标服务商名称" class="form-control" required>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "formalPos/posTransferRecord"
        $("#form-posTransferRecord-transfer").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/transfer", $('#form-posTransferRecord-transfer').serialize());
            }
        }

        function selectPosNo() {
            var url = prefix + "/selectPosNo";
            $.modal.open("选择划拨终端" , url, '1000');
        }

        function selectTargetAgent() {
            var currentAgent=$('#currentAgent').val();
            if (''==currentAgent || undefined==currentAgent){
                $.modal.msgError("请选择划拨信息");
                return;
            }
            var url = prefix + "/selectTargetAgent/"+currentAgent;
            $.modal.open("选择目标服务商名称" , url, '1000');
        }
    </script>
</body>
</html>